home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
dirs
/
fractallab_391.lzh
/
FractalLab
/
Fractal Lab.Docs
< prev
next >
Wrap
Text File
|
1990-10-27
|
13KB
|
266 lines
//////// Fractal Lab 1.0, ©1990 by Terry W. Gintz ///////
The science of Fractals was formally introduced by Benoit Mendelbrot in his
"preface" The Fractal Geometry of Nature. While being very descriptive of
various recursive fractal curves, such as the Koch and Peano curves, this
book says very little on the art of generating such curves with a computer.
Fractal Lab was written to enable a generalized creation of what Mandelbrot
terms self-similiar and self-contacting/non-contacting recursive curves.
Most of these basic curves appearing in The Fractal Geometry of Nature can
be produced using Fractal Lab. And these can be done in color, up to 8
colors. Mandelbrot illustrated these only in black, white and gray scale.
No attempt is made to draw the Mandelbrot set or other complex-number sets.
Fractal landscapes are also outside the scope of this program.
Mandelbrot uses the terms "generator" and "initiator" to describe the basic
building blocks of self-similiar curves. The generator describes the way a
curve is broken down into smaller images of itself. The initiator describes
how the generator is used. The generator for a koch curve would resemble a
line split into three sections, the middle section being replaced with the
upper two legs of a equilateral triangle. The initiator would be a triangle
to form a "koch island". There are various rules for randomizing the
generator and placement of the generator. These will be explained in the
menu command descriptions.
Fractal Lab does more than emulate parts of The Fractal Geometry of Nature,
because it allows one to generate other curves not shown there, and possibly
unimagined ones too. A sample of the curves possible is included on the
program disk. At the higher levels of recursion, some of these curves take
on three-dimensional qualities like molecular models, etc.
This program uses a hi-res/interlace screen with overscan for all drawing and
editing. The screen is 672 by 432. You may need to adjust both your
monitor and run a program like More Rows to view all of it. Lower
resolutions do not produce the desired quality of display for this type of
graphics. Overscan adds to the resolution and quality.
Flicker does appear to be bothersome at times, especially with system
requesters. There are used sparingly. The high use of chip memory in the
main drawing screen made swapping custom screens for editing undesirable.
Topaz 60 was selected for menu and editing fonts to improve readability in
the interlace mode. No attempt was made to customize the color palette to
reduce flicker. Certainly, a palette-change program could be used as a
background process, to do this. Fractal Lab should multi-task without
problems. When in a wait state, the program uses Wait() or Delay() to enable
other tasks to run at full speed. While drawing, there is no Wait or Delay
for maximum drawing speed. You may need to set the priortity for Fractal
Lab lower while drawing to let other tasks run at normal speed.
About the Menus:
The Project Menu:
"New" erases the current generator and initiator. A koch fractal is loaded
and displayed if no command arguments are used in invoking Fractal Lab.
"Clear" clears the screen and sets the background color to what is selected
on the Background Menu (1 of 8 colors).
"Draw" invokes the level window, then draws the current fractal at the
specified level of recursion. Does not clear the screen before drawing or
change the background color. Click the left-mouse button to stop a drawing
in progress.
"Move" changes the cursor to a green plus to locate the fractal's starting
point anywhere on the screen, overriding the setting of the initiator.
Click where you want the fractal to start drawing. Useful for tiling
multiple fractals on the screen, or putting different fractals side by side.
Does not clear the screen before drawing, nor change the random factor when
the RANDOMSIDES flag is set. This enables random dragons to be moved.
"Save" saves the current settings on the Flags and Background menus, and the
data for the generator and initiator segments. Also creates a custom icon
for each fractal file that can invoke Fractal Lab from the workbench and
draw itself. The current level is also saved. You can save a fractal with
only a generator or only an initiator, but it won't get drawn
the next time it is loaded.
"Load" loads a fractal file previously saved by Fractal Lab and draws the
fractal like "Draw" without clearing the screen or changing the background
color, and using the saved level of recursion.
"Quit" exits the program.
The Edit menu:
"Generator" invokes the Edit Generator window explained below.
"Initiator" invokes the Edit Initiator window explained below.
"Scale" invokes the Scale Initiator window explained below.
The Flags Menu:
These items define some rules for placing the generator while drawing.
ALTERNATE tells the generate routine to reverse the side placement of the
generator at each stage of recursion. Must be set to draw snowflakes, etc.
ALTERNATE excludes the RANDOMSIDES and ALTFIRSTPOS flags and enables the
RANDOMREVERSE flag to be set or not.
RANDOMSIDES randomizes the side the generator is placed on at the first stage
of each level of recursion after the first recursion. Must be set to draw
random dragons. Excludes ALTERNATE, ALTFIRSTPOS and disables the
RANDOMREVERSE item.
RANDOMREVERSE reverses the generator without changing the side it is to be
draw on. Used to create random snowflakes, etc.
ALTFIRSTPOS alternates the generator every other level starting with the
lowest level. Excludes ALTERNATE and RANDOMSIDES. Used for the Polya
fractal.
REVRIGHTSIDE reverses the generator when it is drawn on the right side.
Used for the Peano-Gosper fractal and Quartet fractal. Can be used with any
of the other flags, for different effects.
NO FLAGS excludes all other flags and disables RANDOMREVERSE. Use
to display the original dragon curve, or to eliminate the random factor from
any curve that doesn't use ALTERNATE or RANDOMSIDES.
The Background menu:
One of eight items selects the background color that will be displayed
the next time the screen is cleared with Clear. Selection is also saved
with the Save option.
About the windows:
The main window is used for drawing and all other windows/requesters appear
on top of it. It contains depth-adjust gadgets at the top right, though
these are covered up after the first drawing is displayed. Use the depth
adjusters to move the edit windows out of sight if you need to refer to the
drawing details, then to move the edit windows back.
The Edit Generator window allows you to add and edit up to 30 segments for
the fractal generator. The top row of gadgets are the control gadgets and
the lower gadgets are for entering data. There are error messages that
appear between these sets of gadgets to help the user with input.
The Control gadgets:
The # gadget is used to enter a number within the range of existing segments
to insert or recall a segment for changing or deleting. You can also insert
what you recall or add it back too.
The Add gadget adds a segment to the end of the list of generator
segments. You must first enter a valid segment into the data gadgets.
The Change and Delete Gadgets are enabled after using the Recall gadget, to
edit or delete a previously added or inserted segment.
The Insert gadget works with the # gadget to add a segment in front of the
previously added segment.
The Recall gadget enters a previously-added segment into the data gadgets,
to enable editing or deleting it. This prevents erasing or changing a
segment, with the wrong number in the # gadget.
The Cancel gadget cancels a recall operation and re-enables the # and Recall
gadgets.
The Data gadgets:
The Relative Direction gadget defines the direction of the segment relative
to the 90 degree position, (0 is straight up), or full right.
The relative direction ranges from -180 to 180 (degrees).
The Relative Length gadget defines the length of the segment as a
fraction of the total length of the initiator segment length. This ranges
from -1.0 to 1.0. Enter a negative length if you want to move to a new
segment location, instead of drawing the line there. This is useful for
creating "tree" fractals and "island" fractals whose segments are not
necessarily continuous. When you enter a negative length, you must also
enter a relative direction 180 degrees from the direction you want to move,
or the opposite direction (a move is computed as a negative direction.)
All fractional input is rounded to five decimal places.
The Side gadget determines which side the generator will appear at the next
recursion level subject to the settings of the Flags menu, right (0)
or left (1).
There are 8 color gadgets that can be selected for the segment color. The
current color is drawn to right of the word Colors.
The Edit Initiator window is the editor for the fractal initiator. It has
control gadgets that work the same as those with the generator editor, and
different data gadgets. You can add or edit up to 30 segments for each
initiator.
The Data gadgets:
The Direction gadget defines the direction of the initiator segment relative
to 0 degrees, or straight up. Acceptable angles are 0 to 359 degrees.
The Length gadget defines the length of the segment in screen pixels, 1 to
672.
The Side gadget controls which side the generator is placed initially,
left (1) or right (0). For a segment going right 90 degrees, this would
place the first generator upright.
The Left, Right, LeftBottom, RightBottom gadgets set the start and end
positions on screen for each initiator segment. If you don't know the end
position, given the starting position and segment length, you will have to
use a trig function to approximate it. The formulas are as follows:
Right = Left + Sine(degrees) * length
RightBottom = LeftBottom - Cosine(degrees) * length
where degrees is the segment direction. These formulas are accurate plus or
minus a pixel. Under some conditions, aberations will be notices due
to the floating point arithmetic used in Fractal Lab. You may want
to experiment with the end points to get the most accurate results.
If you don't have a calculator with sine and cosine functions,--
The COMPUTE gadget uses the above formulas to enter the approximate end
points into the Right and RightBottom gadgets. (And you thought trig was
work!) Just be sure to enter valid information in the other data gadgets
before clicking COMPUTE. Won't compute the end coordinates if they would
be off the screen.
Note: angles may appear a few degrees off on the finished fractal, if the
screen pixel on your monitor is not exactly square. Relative space between
lines should still allow non-contacting fractals to remain non-contacting.
The Scale Window scales the initiator length and screen positions to
effectively reduce or expand the fractal image. A scale of .5 affects both
X and Y coordinates, so the image is quartered. A scale of 2.0 would make
the image four times as large. A range of .1 to 5.0 is allowed in the scale
gadget, but the program checks that the length never exceeds 672, and the
other points do not exceed screen limits. A fractal may still attempt to
draw itself off screen, and is then clipped. Lines that would end off the
screen are not drawn.
The level window controls the number of recursions the generate routine must
go through before it draws the resulting fractal. The limit is currently
20. This requires a stack of 20000. The icons that the save function
create each time a fractal is saved automatically set the stack to 20000.
There are also requesters that control file retreival and saving files, and
request confirmation before exiting the program or erasing the current
fractal generator and initiator. The file requester is the standard Charlie
Heath requester (not ARP) with a few modifications to allow loading and
saving files to any directory. Enter the directory required in the upper
box, press <return>, or don't enter anything for current directory.
Click on a file name from the file list, or type in a file name in the
bottom box. Click on Okay to load or save the file, or select Cancel to
cancel the file operation.
For more introductory information on fractals, read Mandelbrot's The Fractal
Geometry of Nature, published by W.H. Freeman and Company, New York, 1983.
A more advanced book on fractals, complete with computer algorithms, is
The Science of Fractal Images by Barnsley, Devaney, Mandelbrot and others,
published by Springer-Verlag, New York, 1988.
Any questions, comments or donations for Fractal Lab should be address to:
Terry W. Gintz
4237 Marcum Lane
Eugene, Or 97402
A donation of $20 for Fractal Lab gets you the documentation to all my current
programs, plus additional help with Fractal Lab if you need it, plus any of
the other programs for $5 off their suggested price, plus upgrade privileges
for $10.